const http = require('http')
const server = http.createServer()

server.on('request', (req, res) => {
    const url = req.url;
    const str = '你获取的地址是' + url;
    res.setHeader('Content-Type', 'text/html;charset=utf-8') //固定的写法
    res.end(str)
})
server.listen(80, () => {
    console.log('启动服务器成功');
})